import Vue from "vue";
import Router from "vue-router";
Vue.use(Router);
//获取原型对象上的push函数
const originalPush = Router.prototype.push;
//修改原型对象中的push方法
Router.prototype.push = function push(location) {
  return originalPush.call(this, location).catch(err => err);
};
import VueRouter from "vue-router";

const monitorManager = () => import("@/components/intelligentSystems/monitor_manager.vue");
const nullComponent = { render: e => e("router-view") };

const navBar = () => import("../components/nav_bar.vue");
// const demoZhongshan = () => import("@/components/extraOptions/demo_zhongshan");
const index = () => import("../components/index.vue");
const home = () => import("../components/home.vue");
const personalCenter = () =>
  import("@/components/accountManagement/personalCenter");
const login = () => import("../components/login.vue");

/* 3D */
// const university_module = () => import("../components/extraOptions/module.vue");

//系统管理
const sysorg = () => import("../components/sysManage/sys_org");
const sysrole = () => import("../components/sysManage/sys_role");
const sys_log_operate = () => import("../components/sysManage/sys_log");

const sys_log_login = () => import("../components/sysManage/sys_login_log");

// 智能系统
// 智能系统-视频监控
const videoMonitoringPlay = () =>
  import("../components/intelligentSystems/video-monitoring-play");
// 智能系统-空调
const vrv = () => import("../components/intelligentSystems/vrv");
// 智能系统-送排风
const exhaust = () => import("../components/intelligentSystems/exhaust");
// 智能系统-给排水
const drainage = () => import("../components/intelligentSystems/drainage");
// 智能系统-电梯管理
const elevator = () => import("../components/intelligentSystems/elevator");
const elevatorState = () =>
  import("../components/intelligentSystems/elevator-state");
// 智能系统-环境监测
const environment = () =>
  import("../components/intelligentSystems/environment");
// 智能系统-泳池监测
const swimmingPool = () =>
  import("../components/intelligentSystems/swimming-pool");
// 智能系统-智能照明
const illumination = () =>
  import("../components/intelligentSystems/illumination");

//智能系统-电力监测
const iot_pms = () => import("../components/intelligentSystems/power_monitoring.vue");


//智能系统-能耗管理-统计
const iot_ems = () => import("../components/energyManage/energyManage.vue");
//智能系统-能耗管理-分析
const energyAnalysis = () => import("../components/energyManage/energyAnalysis.vue");

//智能系统-策略控制
const iot_rule = () =>
  import("../components/strategyControl/strategyControl.vue");

//智能系统-新增联动
const addedLinkage = () =>
  import("../components/strategyControl/src/cpns/addedLinkage.vue");
//智能系统-新增联动-最新
const addedLinkage_updata = () =>
import("../components/strategyControl/src/cpns/addedLinkage_updata.vue");

//智能系统-报警系统
const iot_alarm = () => import("../components/alarmSystem/alarmSystem.vue");



//产品管理
const product_list = () => import("../components/product_control/product_list");
const product_details = () => import("../components/product_control/product_details");
const zixitongconfigpage = () =>
  import("../components/product_control/zixitong_config_page");
const device = () => import("../components/product_control/device");
const devicedetails = () =>
  import("../components/product_control/device_details");

// 业务服务

const deviceBrand = () => import("../components/equipmentLedger/deviceBrand.vue"); //设备台账-品牌（新版）
const productCategory = () => import("../components/equipmentLedger/productCategory.vue"); //设备台账-产品类别（新版）
const device_taizhang = () => import("../components/shebeiyunwei/device_taizhang.vue"); //设备台账-（原来）
const service_eoms = () => import("../components/shebeiyunwei/yunweijihua.vue"); //设备运维
// const maintenance = () => import("../components/maintenance/maintenance.vue"); //维保服务
const maintenance = () => import("../components/baoxiubaoyang/property_repair.vue"); //维保服务
const configPage = () => import("../components/baoxiubaoyang/config_page.vue"); //维保服务
// 绑点
const commonLayout = () => import("../components/tiePoints/bind_cad/bind.vue");
const bind_img_point = () => import("../components/bind_cad/bind.vue");

// 基础配置

// 基础配置 -项目管理
const base_project = () => import("../components/baseProject/baseProject.vue");
const base_section = () => import("../components/baseSection/baseSection.vue");

//模板配置
const templateConfig = () => import("../components/product_control/template_config.vue");
//点位模板
const pointTemplate = () => import("../components/product_control/point_template.vue");
//驱动配置
const driveConfig = () => import("../components/product_control/drive_config.vue");
//位号配置
const pointInfoConfig = () => import("../components/product_control/point_info_config.vue");


//设备运维
const sbywjcsx = () => import("../components/shebeiyunwei/jichu_fuwushixian.vue");
const jianchaxiang = () => import("../components/shebeiyunwei/jichu_jianchaxiang.vue");
const shebeifenzu = () => import("../components/shebeiyunwei/jichu_shebeifenzu.vue");
const ywrenyuan = () => import("../components/shebeiyunwei/jichu_ywrenyuan.vue");
const yunweijihua = () => import("../components/shebeiyunwei/yunweijihua.vue");
const qupeizhi = () => import("../components/shebeiyunwei/qupeizhi.vue");
const player = () => import("../components/intelligentSystems/player.vue");

//巡查管理 service_patrol 
const service_patrol = () => import("../components/patrolManage/patrol_management.vue");

const property_inspection_config = () => import("../components/patrolManage/patrol_configuration.vue");
//子系统页面
const subsystemPage = () => import("../components/tiePoints/common_layout.vue");
const commonParkingLog = () => import("../components/parking/common_parking_log.vue");//停车场

const dataHomePage = () => import("../components/Data_dashboard_panel/data_home_page.vue");

//能耗基础配置
const nenghaoConfig = () => import("../components/nengyuanManage/nenghao_config.vue");
//能耗基础配置
const labelManagement = () => import("../components/product_control/label_management.vue");
//安全用电
const electricSafety = () => import("../components/electricSafety/electric.vue");




export default new Router({
  routes: [
    {
      path: "/login",
      name: "登陆",
      component: login
    },
    // {
    //   path: "/",
    //   redirect: "/demoZhongshan"
    // },
    // {
    //   path: "/demoZhongshan",
    //   name: "三维可视化",
    //   component: demoZhongshan
    // },
    // {
    //   path: "/demoZhongshan",
    //   name: "三维可视化",
    //   component: university_module
    // },
    {
      path: "/dataHomePage",
      name: "数据仪表盘",
      component: dataHomePage
    },
    {
      path: "/",
      name: "",
      component: index,
      children: [
        {
          path: "",
          name: "",
          component: navBar,
          children: [
            {
              path: "/player",
              name: "个人中心",
              component: player
            },
            {
              path: "/personalCenter",
              name: "个人中心",
              component: personalCenter
            },{
              path: "/iot_ibms_visualization",
              name: "数据驾驶舱",
              component: home
            },
            {
              path: "/home",
              name: "数据驾驶舱",
              component: home
            },{
              path: '/iot_pms',
              name: '电力监测系统',
              // component: iot_ems,
              component: subsystemPage
            },
            {
              path: '/iot_pms_tongji',
              name: '电力监测系统统计',
              component: iot_ems,
              // component: subsystemPage
            },
            {
              path: '/iot_ips',
              name: '入侵报警系统',
              // component: iot_pms,
              component: subsystemPage
            },
            {
              path: '/iot_afas',
              name: '火灾报警系统',
              // component: iot_pms,
              component: subsystemPage
            },
            
            {
              path: "/iot_ems",
              name: "能耗管理系统",
              // component: iot_ems
              component: subsystemPage
            },
            
            {
              path: "/nenghao_config",
              name: "能耗基础配置",
              // component: iot_ems
              component: nenghaoConfig
            },
            {
              path: "/energyManage",
              name: "能耗统计",
              // component: iot_ems
              component: iot_ems
            },
            {
              path: "/energyAnalysis",
              name: "能耗分析",
              // component: iot_ems
              component: energyAnalysis
            },
            {
              path: "/iot_ess",
              name: "安全用电系统",
              component: electricSafety
            },

            {
              path: "/iot_iics",
              name: "智能照明系统",
              // component: illumination
              component: subsystemPage
            },
            {
              path: "/iot_acs",
              name: "门禁系统",
              // component: iot_pms
              component: subsystemPage
            },
            {
              path: "/iot_cps",
              name: "停车场管理系统",
              // component: iot_pms
              component: commonParkingLog
            },
            {
              path: "/iot_sense",
              name: "烟感系统",
              component: subsystemPage
            },
            {
              path: "/iot_dmb",
              name: "广播系统",
              component: subsystemPage
            },
            {
              path: "/iot_cis",
              name: "对讲系统",
              // component: iot_pms
              component: subsystemPage
            },
            {
              // path: "/video-monitoring",
              path: "/iot_vscs",
              name: "视频监控系统",
              // component: monitorManager,
              // component: nullComponent,
              component: subsystemPage
              // children: [
              //   {
              //     path: "/video-monitoring-play",
              //     name: "监控播放",
              //     component: videoMonitoringPlay
              //   }
              // ]
            },
            {
              path: "/iot_irs",
              name: "信息发布系统",
              // component: iot_pms
              component: subsystemPage
            },
            {
              path: "/iot_nms",
              name: "计算机网络系统",
              // component: iot_pms
              component: subsystemPage
            },
          ]
        },
        
        {
          path: "",
          name: "楼控系统",
          component: navBar,
          children: [
            {
              path: "/iot_ba_hvac",
              name: "暖通空调系统",
              component: subsystemPage
            },
            // {
            //   path: "/iot_ba_es",
            //   name: "送排风监测系统",
            //   component: exhaust
            // },
            {
              path: "/iot_ba_es",
              name: "送排风监测系统",
              component: subsystemPage
            },
            {
              path: "/iot_ba_wsads",
              name: "给排水监测系统",
              component: subsystemPage
            },
            {
              path: "/iot_ba_emis",
              name: "环境监测系统",
              component: subsystemPage
            },
            {
              path: "/iot_ba_spms",
              name: "泳池管理",
              component: subsystemPage
            },
            {
              path: "/iot_ba_ecs",
              name: "梯梯监测系统",
              component: subsystemPage
              // component: nullComponent,
              // children: [
              //   {
              //     path: "/",
              //     name: "",
              //     component: elevator
              //   },
              //   {
              //     path: "/state",
              //     name: "状态查看",
              //     component: elevatorState
              //   }
              // ]
            },
            {
              path: "/iot_ba_lls",
              name: "景观照明系统",
              component: subsystemPage
            },
            
            
          ]
        },
        {
          path: "",
          name: "系统管理",
          component: navBar,
          children: [
            {
              path: "/sys_org",
              name: "组织架构",
              component: sysorg
            },
            {
              path: "/sys_role",
              name: "角色管理",
              component: sysrole
            },
            {
              path: "/sys_log",
              name: "日志管理",
              component: nullComponent,
              children: [
                {
                path: "/sys_log_operate",
                name: "操作日志",
                component: sys_log_operate
              },{
                path: "/sys_log_login",
                name: "登录日志",
                component: sys_log_login
              }]
            },
            {
              path: "/iot_rule",
              name: "策略控制",
              component: iot_rule,
              children: [
                {
                  path: "addedLinkage",
                  name: "新增联动",
                  component: addedLinkage
                },{
                  path: "addedLinkage_updata",
                  name: "新增联动",
                  component: addedLinkage_updata
                  
                }
              ]
            },
            {
              path: "/iot_alarm",
              name: "报警系统",
              component: iot_alarm
            },
            
          ]
        },
        {
          path: "",
          name: "基础配置",
          component: navBar,
          children: [
            {
              path: "/base_project",
              name: "项目管理",
              component: base_project
            },
            {
              path: "/base_section",
              name: "区域管理",
              component: base_section
            },
            {
              path: "/iot_hardware",
              name: "设备管理",
              component: nullComponent,
              children: [{
                path: "/iot_hardware_product",
                name: "产品管理",
                component: product_list,
              },
              // children:[
                {
                  path: "/product_details",
                  name: '产品管理详情',
                  component: product_details,
                },
              // ]
               {
                path: '/iot_hardware_device',
                name: '设备管理',
                component: device,
              }, 
              // children:[
                {
                 path: '/device_details',
                 name: '设备详情',
                 component: devicedetails,
               }, 
            //  ]
              {
                path: '/zixitongconfigpage',
                name: '子系统管理',
                component: zixitongconfigpage,
              }]
            },{
              path: '/iot_device_2d',
              name: "设备绑点",
              component: commonLayout,
            }
            ,{
              path: '/iot_hardware_profile',
              name: "模板管理",
              component: templateConfig,
            }
            ,{
              path: '/iot_hardware_point',
              name: "位号管理",
              component: pointTemplate,
            },{
              path: '/iot_hardware_driver_info',
              name: "驱动配置",
              component: driveConfig,
            },{
              path: '/iot_hardware_point_info',
              name: "位号配置",
              component: pointInfoConfig,
            }
          ]
        },
        {
          path: "",
          name: "人员管理",
          component: navBar,
          children: [
            {
              path: "/user_manager",
              name: "员工管理",
              component: () => import('../components/sysManage/sys_manager')
            },
            {
              path: "/user_user",
              name: "用户管理",
              component: () => import('../components/sysManage/sys_user_manager')
            },
          ]
        },
        {
          path: "",
          name: "业务服务",
          component: navBar,
          children: [
            
            {
              path: "/service_patrol",
              name: "巡查管理",
              component: service_patrol,
              // 
            },
            {
              path: "/property_inspection_config",
              name: "巡查基础配置",
              component: property_inspection_config,
              // 
            },
            {
              path: "/deviceBrand",
              name: "设备台账——设备品牌",
              component: deviceBrand,
              // 
            },
            {
              path: "/labelManagement",
              name: "标签管理",
              component: labelManagement,
              // 
            },
            {
              path: "/productCategory",
              name: "设备台账——产品类别",
              component: productCategory,
              // 
            },
            {
              path: "/device_taizhang",
              name: "设备台账",
              component: device_taizhang,
              // 
            },
            {
              path: "/service_eoms",
              name: "设备运维",
              component: service_eoms,
              // 
            },
            {
              path: "/service_maintain",
              name: "维保服务",
              component: maintenance
            },
            {
              path: "/property_device_operation_config",
              name: "运维基础配置",
              component: qupeizhi
            },
            {
              path: "/property_maintenance_repair",
              name: "维保服务基础配置",
              component: configPage
            }
            // , {
            //   path: "/common",
            //   name: "",
            //   component: commonLayout,
            //   children: [
            
            //   ]
            // }
          ]
        },{
          path: "",
          name: "设备运维",
          component: navBar,
          children: [
            {
              path: "/sbywjcsx",
              name: "运维服务时限配置",
              component: sbywjcsx
            },
            {
              path: "/jianchaxiang",
              name: "运维检查项",
              component: jianchaxiang
            },
            {
              path: "/shebeifenzu",
              name: "运维设备分组",
              component: shebeifenzu
            },
            {
              path: "/ywrenyuan",
              name: "运维人员配置",
              component: ywrenyuan
            },
            {
              path: "/yunweijihua",
              name: "运维计划",
              component: yunweijihua
            },
          ]
        }
      ]
    }
  ]
})

// const router = new VueRouter({
//   // mode: "hash",
//   mode: 'history',
//   // base: '/dist/',
//   base: process.env.VUE_BASE_URL,
//   routes
// });

// export default router;
